package com.huabo.system.service.impl;

import com.huabo.system.config.DateBaseConfig;
import com.huabo.system.mysql.entity.TblYyUserQueryMySql;
import com.huabo.system.mysql.mapper.TblYyUserQueryMySqlMapper;
import com.huabo.system.oracle.entity.TblYyUserQuery;
import com.huabo.system.oracle.mapper.TblYyUserQueryMapper;
import com.huabo.system.service.TblYyUserQueryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
public class TblYyUserQueryServiceImpl implements TblYyUserQueryService {

    @Resource
    private TblYyUserQueryMapper tblYyUserQueryMapper;

    @Resource
    private TblYyUserQueryMySqlMapper tblYyUserQueryMySqlMapper;


    @Override
    public Map<String, Object> selectUserQueryById(Integer recordId) throws Exception {
        if (DateBaseConfig.DATABASETYPE.equals("Oracle")) {
            Map<String, Object> resultMap = new HashMap<String, Object>(0);
            TblYyUserQuery tblYyUserQuery = tblYyUserQueryMapper.selectByrecordId(recordId);
            resultMap.put("code", "1");
            resultMap.put("msg", "数据访问成功");
            resultMap.put("data", tblYyUserQuery);
            return resultMap;
        } else {
            Map<String, Object> resultMap = new HashMap<String, Object>(0);
            TblYyUserQueryMySql tblYyUserQuery = tblYyUserQueryMySqlMapper.selectByrecordId(recordId);
            resultMap.put("code", "1");
            resultMap.put("msg", "数据访问成功");
            resultMap.put("data", tblYyUserQuery);
            return resultMap;
        }
    }
}
